package com.talent.pojo.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 导入记录实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ImportRecord {
    
    private Long id;
    private Integer rowIndex; // Excel行号
    private String spotName; // 点位名称
    private String categoryName; // 分类名称
    private String status; // 导入状态：SUCCESS、FAILED
    private String errorMessage; // 错误信息
    private LocalDateTime createTime;
    
    // 构造方法
    public ImportRecord() {
        this.createTime = LocalDateTime.now();
    }
    
    // 设置成功状态
    public void setSuccess() {
        this.status = "SUCCESS";
        this.errorMessage = null;
    }
    
    // 设置失败状态
    public void setFailed(String errorMessage) {
        this.status = "FAILED";
        if(this.errorMessage == null) {
            this.errorMessage = errorMessage;
        }else{
            this.errorMessage+= "; " + errorMessage; // 累加错误信息
        }
    }

    public void setComplete() {
        this.status = "COMPLETE";
    }
}
